//
//  MainViewController.m
//  Sight
//
//  Created by chen on 16/6/23.
//  Copyright (c) 2016年 chen. All rights reserved.
//

#import "Masonry.h"
#import "HRGuideView.h"
#import "MainViewController.h"
#import "ImageProViewController.h"
#import "BeautifyViewController.h"

@interface MainViewController ()

@end

@implementation MainViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    //添加引导功能
    NSMutableArray *images = [[NSMutableArray alloc]init];
    [images addObject:[UIImage imageNamed:@"1.png"]];
    [images addObject:[UIImage imageNamed:@"2.png"]];
    [images addObject:[UIImage imageNamed:@"3.png"]];
    [[HRGuideViewManager sharedInstance]showGuideViewWithImages:images
                                                 andButtonTitle:@"开始体验"
                                            andButtonTitleColor:[UIColor whiteColor]
                                               andButtonBGColor:[UIColor clearColor]
                                           andButtonBorderColor:[UIColor whiteColor]];

   //键样式
    UIButton *albumBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:albumBtn];
    [albumBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [albumBtn setBackgroundColor:[UIColor colorWithRed:37/255.0f green:175/255.0f blue:148/255.0f alpha:1.0f]];
    [albumBtn setTitle:@"美图" forState:UIControlStateNormal];
    [albumBtn setFont:[UIFont fontWithName:@"Arial-BoldItalicMT" size:30]];
    [albumBtn.layer setBorderWidth:5];
    [albumBtn.layer setBorderColor:[[UIColor whiteColor]CGColor]];
    albumBtn.tag=0;
    [albumBtn addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
    //键约束,按键跟随屏幕大小变化
    [albumBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view).with.offset(100);
        make.left.equalTo(self.view.mas_left).with.offset(10);
        make.right.equalTo(self.view.mas_right).multipliedBy(0.5).offset(-5);
        make.height.equalTo(albumBtn.mas_width);
    }];
    
    //键样式
    UIButton *takePhotoBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:takePhotoBtn];
    [takePhotoBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [takePhotoBtn setBackgroundColor:[UIColor colorWithRed:37/255.0f green:175/255.0f blue:148/255.0f alpha:1.0f]];
    [takePhotoBtn setTitle:@"美颜" forState:UIControlStateNormal];
    [takePhotoBtn setFont:[UIFont fontWithName:@"Arial-BoldItalicMT" size:30]];
    [takePhotoBtn.layer setBorderWidth:5];
    [takePhotoBtn.layer setBorderColor:[[UIColor whiteColor]CGColor]];
    takePhotoBtn.tag=1;
    [takePhotoBtn addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
    //键约束
    [takePhotoBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.view).with.offset(100);
        make.left.equalTo(self.view.mas_right).multipliedBy(0.5).offset(5);
        make.right.equalTo(self.view.mas_right).offset(-10);
        make.height.equalTo(takePhotoBtn.mas_width);
    }];
    
    //键样式
    UIButton *videoBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:videoBtn];
    [videoBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [videoBtn setBackgroundColor:[UIColor colorWithRed:37/255.0f green:175/255.0f blue:148/255.0f alpha:1.0f]];
    [videoBtn setTitle:@"相机" forState:UIControlStateNormal];
    [videoBtn setFont:[UIFont fontWithName:@"Arial-BoldItalicMT" size:30]];
    [videoBtn.layer setBorderWidth:5];
    [videoBtn.layer setBorderColor:[[UIColor whiteColor]CGColor]];
    videoBtn.tag=2;
    [videoBtn addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
    //键约束,按键跟随屏幕大小变化
    [videoBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(albumBtn.mas_bottom).with.offset(20);
        make.left.equalTo(self.view.mas_left).with.offset(10);
        make.right.equalTo(self.view.mas_right).multipliedBy(0.5).offset(-5);
        make.height.equalTo(videoBtn.mas_width);
    }];
    
    //键样式
    UIButton *recordBtn=[UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:recordBtn];
    [recordBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [recordBtn setBackgroundColor:[UIColor colorWithRed:37/255.0f green:175/255.0f blue:148/255.0f alpha:1.0f]];
    [recordBtn setTitle:@"美拍" forState:UIControlStateNormal];
    [recordBtn setFont:[UIFont fontWithName:@"Arial-BoldItalicMT" size:30]];
    [recordBtn.layer setBorderWidth:5];
    [recordBtn.layer setBorderColor:[[UIColor whiteColor]CGColor]];
    recordBtn.tag=3;
    [recordBtn addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
    //键约束
    [recordBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(albumBtn.mas_bottom).with.offset(20);
        make.left.equalTo(self.view.mas_right).multipliedBy(0.5).offset(5);
        make.right.equalTo(self.view.mas_right).offset(-10);
        make.height.equalTo(recordBtn.mas_width);
    }];
    
}

-(void)buttonPressed:(UIButton *)button
{
    
    switch (button.tag) {
        case 0:
        {

            UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"ImagePro" bundle:nil];
            UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:@"ImageProViewController"];
            [self.navigationController presentViewController:viewController animated:YES completion:nil];

            break;
        }
        case 1:
        {
            UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Beautify" bundle:nil];
            UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:@"BeautifyViewController"];
            [self.navigationController presentViewController:viewController animated:YES completion:nil];
            break;
        }
        case 2:
        {
            UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Camera" bundle:nil];
            UIViewController *viewController = [storyBoard instantiateViewControllerWithIdentifier:@"CameraViewController"];
            [self.navigationController presentViewController:viewController animated:YES completion:nil];
            break;
        }
        default:
            break;
    }
}



@end
